package com.googlecode.garbagecan.cxfstudy.jaxws;

import javax.xml.ws.Endpoint;

import org.apache.cxf.interceptor.LoggingInInterceptor;
import org.apache.cxf.interceptor.LoggingOutInterceptor;
import org.apache.cxf.jaxws.JaxWsServerFactoryBean;

public class MyServer {
	
	private static final String address = "http://0.0.0.0:9000/ws/jaxws/customerService";
	
	public static void main(String[] args) throws Exception {
		// http://localhost:9000/ws/jaxws/customerService?wsdl
		publishService1();
//		publishService2();
	}
	
	public static void publishService1() {
		Endpoint.publish(address, new CustomerServiceImpl());
	}
	
	public static void publishService2() {
		JaxWsServerFactoryBean factoryBean = new JaxWsServerFactoryBean();
		factoryBean.getInInterceptors().add(new LoggingInInterceptor());
		factoryBean.getOutInterceptors().add(new LoggingOutInterceptor());

		factoryBean.setServiceClass(CustomerServiceImpl.class);
		factoryBean.setAddress(address);
		factoryBean.create();
	}
}
